package com.jww.cloud.service.user.server.controller;

import com.jww.base.am.model.dos.SysRoleDO;
import com.jww.base.am.service.SysRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/roles")
@Api(value = "角色管理", tags = "角色管理")
public class SysRoleController {

    @Autowired
    private SysRoleService sysRoleService;

    @GetMapping
    @ApiOperation(value = "查询角色", notes = "根据用户ID查询角色")
    public List<SysRoleDO> listByUserId(@RequestParam("userId") Long userId) {
        return sysRoleService.listByUserId(userId);
    }
}
